set the visible of sprite the spriteNum of me to 0
set normalColor to the foreColor of sprite the spriteNum of me
if downColor = EMPTY then
set downColor to -1
else
set downColor to integer(downColor)
end if
if hiColor = EMPTY then
set hiColor to downColor
else
set hiColor to integer(hiColor)
end if
if rolloverColor = EMPTY then
set rolloverColor to -1
else
set rolloverColor to integer(rolloverColor)
end if
if stringp(linkLabel) then
if linkLabel contains "marker(" then
do("set linkLabel=" & linkLabel)
set segmentEnd to 0
else
set segmentEnd to label(linkLabel & "-end")
set linkLabel to label(linkLabel)
end if
set linkLabel to string(linkLabel)
else
set segmentEnd to 0
end if
fixState(me)
end
on fixState me
if atMyLocation(me) = 1 then
set the foreColor of sprite the spriteNum of me to hiColor
else
if ready(me) then
activate(me)
else
deactivate(me)
end if
end if
end
on atMyLocation me
if stringp(linkLabel) then
if the frameLabel contains "-end" then
set checkMarker to -1
else
set checkMarker to 0
end if
if (the frame = integer(linkLabel)) or (marker(checkMarker) = integer(linkLabel)) then
return 1
end if
else
return 0
end if
end
on ready me
if stringp(linkLabel) then
if segmentEnd then
return frameReady(segmentEnd)
else
return frameReady(integer(linkLabel))
end if
else
if integerp(linkLabel) then
return frameReady(marker(linkLabel))
end if
end if
end
on activate me
set the foreColor of sprite the spriteNum of me to normalColor
set the visible of sprite the spriteNum of me to 1
set active to 1
end
on deactivate me
set the visible of sprite the spriteNum of me to 0
set active to 0
end
on mouseDown me
if (downColor >= 0) and active then
set the foreColor of sprite the spriteNum of me to downColor
updateStage()
else
if not active then
nothing()
end if
end if
end
on mouseUp me
if active then
if stringp(linkLabel) then
puppetTransition(4, 1)
go(integer(linkLabel))
else
if integerp(linkLabel) then
puppetTransition(4, 30)
go(marker(linkLabel))
end if
end if
sendAllSprites(#fixState)
end if
end
on mouseEnter me
if active and not atMyLocation(me) then
set the foreColor of sprite the spriteNum of me to rolloverColor
updateStage()
end if
end
on mouseLeave me
if active and not atMyLocation(me) then
if atMyLocation(me) then
set the foreColor of sprite the spriteNum of me to hiColor
else
set the foreColor of sprite the spriteNum of me to normalColor
end if
updateStage()
end if
end
on exitFrame me
if not active then
if ready(me) then
activate(me)
end if
end if
end
on endSprite me
set the visible of sprite the spriteNum of me to 1
puppetSprite(the spriteNum of me, 0)
end
on getPropertyDescriptionList
set p_list to [#downColor: [#comment: "Mouse Down Color:", #format: #integer, #default: EMPTY], #hiColor: [#comment: "Hilited Color:", #format: #integer, #default: EMPTY], #rolloverColor: [#comment: "rollOver Color:", #format: #integer, #default: EMPTY], #linkLabel: [#comment: "Marker To Go To:", #format: #string, #default: EMPTY]]
return p_list
end
on getBehaviorDescription
return "Use a shape cast member as a button to link to other markers in the current movie." & "The default color is picked up from the color in the score at initialization." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Mouse Down Color - The shape will use this color when clicked." & RETURN & "ΓÇó Hilited Color (optional) - The shape will use this color when the movie is in the label that the shape links to." & RETURN & "ΓÇó rollOver Color - The rollOver state color for the shape or bitmap." & RETURN & "ΓÇó Marker To Go To - The shape go to this label when clicked."